<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This file documents the use of the GNU compilers.

Copyright (C) 1988-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>MSP430 Options (Using the GNU Compiler Collection (GCC))</title>

<meta name="description" content="MSP430 Options (Using the GNU Compiler Collection (GCC))">
<meta name="keywords" content="MSP430 Options (Using the GNU Compiler Collection (GCC))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html#Top" rel="start" title="Top">
<link href="Indices.html#Indices" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Submodel-Options.html#Submodel-Options" rel="up" title="Submodel Options">
<link href="NDS32-Options.html#NDS32-Options" rel="next" title="NDS32 Options">
<link href="Moxie-Options.html#Moxie-Options" rel="prev" title="Moxie Options">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en_US">
<a name="MSP430-Options"></a>
<div class="header">
<p>
Next: <a href="NDS32-Options.html#NDS32-Options" accesskey="n" rel="next">NDS32 Options</a>, Previous: <a href="Moxie-Options.html#Moxie-Options" accesskey="p" rel="prev">Moxie Options</a>, Up: <a href="Submodel-Options.html#Submodel-Options" accesskey="u" rel="up">Submodel Options</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="MSP430-Options-1"></a>
<h4 class="subsection">3.19.32 MSP430 Options</h4>
<a name="index-MSP430-Options"></a>

<p>These options are defined for the MSP430:
</p>
<dl compact="compact">
<dd>
<a name="index-masm_002dhex"></a>
</dd>
<dt><code>-masm-hex</code></dt>
<dd><p>Force assembly output to always use hex constants.  Normally such
constants are signed decimals, but this option is available for
testsuite and/or aesthetic purposes.
</p>
<a name="index-mmcu_003d"></a>
</dd>
<dt><code>-mmcu=</code></dt>
<dd><p>Select the MCU to target.  This is used to create a C preprocessor
symbol based upon the MCU name, converted to upper case and pre- and
post-fixed with &lsquo;<samp>__</samp>&rsquo;.  This in turn is used by the
<samp>msp430.h</samp> header file to select an MCU-specific supplementary
header file.
</p>
<p>The option also sets the ISA to use.  If the MCU name is one that is
known to only support the 430 ISA then that is selected, otherwise the
430X ISA is selected.  A generic MCU name of &lsquo;<samp>msp430</samp>&rsquo; can also be
used to select the 430 ISA.  Similarly the generic &lsquo;<samp>msp430x</samp>&rsquo; MCU
name selects the 430X ISA.
</p>
<p>In addition an MCU-specific linker script is added to the linker
command line.  The script&rsquo;s name is the name of the MCU with
<samp>.ld</samp> appended.  Thus specifying <samp>-mmcu=xxx</samp> on the <code>gcc</code>
command line defines the C preprocessor symbol <code>__XXX__</code> and
cause the linker to search for a script called <samp>xxx.ld</samp>.
</p>
<p>The ISA and hardware multiply supported for the different MCUs is hard-coded
into GCC.  However, an external &lsquo;<samp>devices.csv</samp>&rsquo; file can be used to
extend device support beyond those that have been hard-coded.
</p>
<p>GCC searches for the &lsquo;<samp>devices.csv</samp>&rsquo; file using the following methods in the
given precedence order, where the first method takes precendence over the
second which takes precedence over the third.
</p>
<dl compact="compact">
<dt>Include path specified with <code>-I</code> and <code>-L</code></dt>
<dd><p>&lsquo;<samp>devices.csv</samp>&rsquo; will be searched for in each of the directories specified by
include paths and linker library search paths.
</p></dd>
<dt>Path specified by the environment variable &lsquo;<samp>MSP430_GCC_INCLUDE_DIR</samp>&rsquo;</dt>
<dd><p>Define the value of the global environment variable
&lsquo;<samp>MSP430_GCC_INCLUDE_DIR</samp>&rsquo;
to the full path to the directory containing devices.csv, and GCC will search
this directory for devices.csv.  If devices.csv is found, this directory will
also be registered as an include path, and linker library path.  Header files
and linker scripts in this directory can therefore be used without manually
specifying <code>-I</code> and <code>-L</code> on the command line.
</p></dd>
<dt>The &lsquo;<samp>msp430-elf{,bare}/include/devices</samp>&rsquo; directory</dt>
<dd><p>Finally, GCC will examine &lsquo;<samp>msp430-elf{,bare}/include/devices</samp>&rsquo; from the
toolchain root directory.  This directory does not exist in a default
installation, but if the user has created it and copied &lsquo;<samp>devices.csv</samp>&rsquo;
there, then the MCU data will be read.  As above, this directory will
also be registered as an include path, and linker library path.
</p>
</dd>
</dl>
<p>If none of the above search methods find &lsquo;<samp>devices.csv</samp>&rsquo;, then the
hard-coded MCU data is used.
</p>

<a name="index-mwarn_002dmcu"></a>
<a name="index-mno_002dwarn_002dmcu"></a>
</dd>
<dt><code>-mwarn-mcu</code></dt>
<dt><code>-mno-warn-mcu</code></dt>
<dd><p>This option enables or disables warnings about conflicts between the
MCU name specified by the <samp>-mmcu</samp> option and the ISA set by the
<samp>-mcpu</samp> option and/or the hardware multiply support set by the
<samp>-mhwmult</samp> option.  It also toggles warnings about unrecognized
MCU names.  This option is on by default.
</p>
<a name="index-mcpu_003d-4"></a>
</dd>
<dt><code>-mcpu=</code></dt>
<dd><p>Specifies the ISA to use.  Accepted values are &lsquo;<samp>msp430</samp>&rsquo;,
&lsquo;<samp>msp430x</samp>&rsquo; and &lsquo;<samp>msp430xv2</samp>&rsquo;.  This option is deprecated.  The
<samp>-mmcu=</samp> option should be used to select the ISA.
</p>
<a name="index-msim-5"></a>
</dd>
<dt><code>-msim</code></dt>
<dd><p>Link to the simulator runtime libraries and linker script.  Overrides
any scripts that would be selected by the <samp>-mmcu=</samp> option.
</p>
<a name="index-mlarge"></a>
</dd>
<dt><code>-mlarge</code></dt>
<dd><p>Use large-model addressing (20-bit pointers, 20-bit <code>size_t</code>).
</p>
<a name="index-msmall"></a>
</dd>
<dt><code>-msmall</code></dt>
<dd><p>Use small-model addressing (16-bit pointers, 16-bit <code>size_t</code>).
</p>
<a name="index-mrelax-3"></a>
</dd>
<dt><code>-mrelax</code></dt>
<dd><p>This option is passed to the assembler and linker, and allows the
linker to perform certain optimizations that cannot be done until
the final link.
</p>
<a name="index-mhwmult_003d"></a>
</dd>
<dt><code>mhwmult=</code></dt>
<dd><p>Describes the type of hardware multiply supported by the target.
Accepted values are &lsquo;<samp>none</samp>&rsquo; for no hardware multiply, &lsquo;<samp>16bit</samp>&rsquo;
for the original 16-bit-only multiply supported by early MCUs.
&lsquo;<samp>32bit</samp>&rsquo; for the 16/32-bit multiply supported by later MCUs and
&lsquo;<samp>f5series</samp>&rsquo; for the 16/32-bit multiply supported by F5-series MCUs.
A value of &lsquo;<samp>auto</samp>&rsquo; can also be given.  This tells GCC to deduce
the hardware multiply support based upon the MCU name provided by the
<samp>-mmcu</samp> option.  If no <samp>-mmcu</samp> option is specified or if
the MCU name is not recognized then no hardware multiply support is
assumed.  <code>auto</code> is the default setting.
</p>
<p>Hardware multiplies are normally performed by calling a library
routine.  This saves space in the generated code.  When compiling at
<samp>-O3</samp> or higher however the hardware multiplier is invoked
inline.  This makes for bigger, but faster code.
</p>
<p>The hardware multiply routines disable interrupts whilst running and
restore the previous interrupt state when they finish.  This makes
them safe to use inside interrupt handlers as well as in normal code.
</p>
<a name="index-minrt"></a>
</dd>
<dt><code>-minrt</code></dt>
<dd><p>Enable the use of a minimum runtime environment - no static
initializers or constructors.  This is intended for memory-constrained
devices.  The compiler includes special symbols in some objects
that tell the linker and runtime which code fragments are required.
</p>
<a name="index-mtiny_002dprintf"></a>
</dd>
<dt><code>-mtiny-printf</code></dt>
<dd><p>Enable reduced code size <code>printf</code> and <code>puts</code> library functions.
The &lsquo;<samp>tiny</samp>&rsquo; implementations of these functions are not reentrant, so
must be used with caution in multi-threaded applications.
</p>
<p>Support for streams has been removed and the string to be printed will
always be sent to stdout via the <code>write</code> syscall.  The string is not
buffered before it is sent to write.
</p>
<p>This option requires Newlib Nano IO, so GCC must be configured with
&lsquo;<samp>--enable-newlib-nano-formatted-io</samp>&rsquo;.
</p>
<a name="index-mmax_002dinline_002dshift_003d"></a>
</dd>
<dt><code>-mmax-inline-shift=</code></dt>
<dd><p>This option takes an integer between 0 and 64 inclusive, and sets
the maximum number of inline shift instructions which should be emitted to
perform a shift operation by a constant amount.  When this value needs to be
exceeded, an mspabi helper function is used instead.  The default value is 4.
</p>
<p>This only affects cases where a shift by multiple positions cannot be
completed with a single instruction (e.g. all shifts &gt;1 on the 430 ISA).
</p>
<p>Shifts of a 32-bit value are at least twice as costly, so the value passed for
this option is divided by 2 and the resulting value used instead.
</p>
<a name="index-mcode_002dregion"></a>
<a name="index-mdata_002dregion"></a>
</dd>
<dt><code>-mcode-region=</code></dt>
<dt><code>-mdata-region=</code></dt>
<dd><p>These options tell the compiler where to place functions and data that
do not have one of the <code>lower</code>, <code>upper</code>, <code>either</code> or
<code>section</code> attributes.  Possible values are <code>lower</code>,
<code>upper</code>, <code>either</code> or <code>any</code>.  The first three behave
like the corresponding attribute.  The fourth possible value -
<code>any</code> - is the default.  It leaves placement entirely up to the
linker script and how it assigns the standard sections
(<code>.text</code>, <code>.data</code>, etc) to the memory regions.
</p>
<a name="index-msilicon_002derrata"></a>
</dd>
<dt><code>-msilicon-errata=</code></dt>
<dd><p>This option passes on a request to assembler to enable the fixes for
the named silicon errata.
</p>
<a name="index-msilicon_002derrata_002dwarn"></a>
</dd>
<dt><code>-msilicon-errata-warn=</code></dt>
<dd><p>This option passes on a request to the assembler to enable warning
messages when a silicon errata might need to be applied.
</p>
<a name="index-mwarn_002ddevices_002dcsv"></a>
<a name="index-mno_002dwarn_002ddevices_002dcsv"></a>
</dd>
<dt><code>-mwarn-devices-csv</code></dt>
<dt><code>-mno-warn-devices-csv</code></dt>
<dd><p>Warn if &lsquo;<samp>devices.csv</samp>&rsquo; is not found or there are problem parsing it
(default: on).
</p>
</dd>
</dl>

<hr>
<div class="header">
<p>
Next: <a href="NDS32-Options.html#NDS32-Options" accesskey="n" rel="next">NDS32 Options</a>, Previous: <a href="Moxie-Options.html#Moxie-Options" accesskey="p" rel="prev">Moxie Options</a>, Up: <a href="Submodel-Options.html#Submodel-Options" accesskey="u" rel="up">Submodel Options</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
